package lab02.test03;

import java.util.*;

public class Main {

    public static void main(String[] args) {


        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = scanner.nextInt();
        }

        int target = scanner.nextInt();

        List<Integer> list = new ArrayList<Integer>(array.length);
        for (int i = 0; i < n; i++) {

            list.add(array[i]);
        }

        int[] index = new int[2];

        for (int i = 0; i < n; i++) {

            int sub = target - array[i];

            if (list.contains(sub)) {

                index[0] = i;
                index[1] = list.indexOf(sub);

                break;

            }
        }

        System.out.println(index[0] + " " + index[1]);
    }
}
